The present invention generally relates to data processing. The invention relates more specifically to a mechanism that enables and manages persistence properties of objects. A computer program listing appendix was submitted on computer disk. A computer program listing appendix was submitted on compact disk.
Computer networks have become ubiquitous in the home, office, and industrial environment. As computer networks have grown ever more complex, automated mechanisms for organizing and managing the networks have emerged. These mechanisms are generally implemented in the form of one or more computer programs, and are generically known as network management systems or applications.
FIG. 1 is a simplified diagram of a network 100 that is managed by a network management station 10. The network 100 comprises one or more network devices 102, such as switches, routers, bridges, gateways, and other devices. Each network device 102 is coupled to another network device 102, or to one or more end stations 120. Each end station 120 is a terminal node of the network 100 at which some type of work is carried out. For example, an end station 120 is a workstation, a printer, a server, or similar device.
Each network device 102 executes a network-oriented operating system 110. An example of a network-oriented operating system is the Internetworking Operating System (IOS) commercially available from Cisco Systems, Inc. Each network device 102 also executes one or more applications 112 under control of the operating system 102. The operating system 102 supervises operation of the applications 112 and communicates over network connections 104 using an agreed-upon network communication protocol, such as Simplified Network Management Protocol (SNMP).
Each device 102 stores information about its current configuration, and other information, in a Management Information Base (MIB) 114. Information in the MIB 114 is organized in one or more MIB variables. The network management station 10 can send fetch and set commands to the device 102 in order to retrieve or set values of MIB variables. Examples of MIB variables include SysObjectID or SysOID.
Preferably the network management station 10 is a general-purpose computer system of the type shown and described further herein in connection with FIG. 10. The network management station 10 executes one or more software components that carry out the functions shown in block diagram form in FIG. 1. For example, the network management station 10 executes a basic input/output system (BIOS) 20 that controls and governs interaction of upper logical layers of the software components with hardware of the network management station. An example of a suitable BIOS is the Phoenix ROM BIOS. The network management station 10 also executes an operating system 30 that supervises and controls operation of upper-level application programs. An example of a suitable operating system is the Microsoft Windows NT(copyright) operating system.
The network management station 10 executes an asynchronous network interface 50 or ANI under control of the operating system 30. The ANI 50 provides an interface to the network 100 and communicates with the network using SNMP or another agreed-upon protocol. The ANI 50 provides numerous low-level services and functions for use by higher-level applications.
The network management station 10 executes a network management system 40 that interacts with a database 60 containing information about the managed network 100. The network management system 40 is an example of a network management application. Using a network management application, a manager can monitor and control network components. For example, a network management application enables a manager to interrogate devices such as host computers, routers, switches, and bridges to determine their status, and to obtain statistics about the networks to which they attach. The network management application also enables a manager to control such devices by changing routes and configuring network interfaces. Examples network management applications are CiscoWorks, CiscoWorks for Switched Internetworks (CWSI), and CiscoView, each of which is commercially available from Cisco Systems, Inc.
In these and a variety of other information-processing contexts, it is useful to have a persistent record of the state of a particular physical object. For example, in a computer program that manages devices in a computer network, it is useful to have persistent records of the state of managed objects in the network. In this context, xe2x80x9cmanaged objectxe2x80x9d means a switch, router, user comment, etc. xe2x80x9cPersistentxe2x80x9d means recorded in consistent copies in a primary store and a non-volatile secondary store, such that the copy in the secondary store is recoverable after a failure of the primary store or a failure of the power supply of the secondary store. The persistent records enable the network management system to be restored after a failure, and make information about the network available externally.
Generally, the state of a particular physical object is stored in a data structure that is created and used by an application program. Object-oriented programming languages have become increasingly popular recently and are now the dominant mechanism used for professional software development and deployment. Java(copyright) is an example of an object-oriented programming language.
In a network management system that is implemented as an object-oriented application program, information about managed objects is stored in one or more programmatic objects. An example of an element of a network management system is the Asynchronous Network Interface (ANI) system that forms a part of the CiscoWorks for Switched Internetworks (CWSI) system commercially offered by Cisco Systems, Inc. ANI queries a computer network, discovers a device in the network such as a router or switch, loads information from the device and retains the information in its store. If there is a failure of ANI or its host computer, it is desirable upon restarting ANI to have a record of the information that has been discovered, changes that have been made, and other information. To retain such a record, the programmatic objects that form ANI must be stored externally in some manner.
In past approaches, the persistent records have been stored in some kind of standard database that is capable of organizing the information for both storage and retrieval. Traditionally, such storage is defined using a declarative database language, a procedural language that maps program objects representing managed objects to definitions of corresponding database objects, and a procedural language to perform actual storage and retrieval of database objects. Generally, the storage and retrieval operations are explicitly scheduled by the writer of the program that uses the database.
This approach has several disadvantages. In particular, there is a need to coordinate the external definitions of the data store with the internal program definitions that map to the external definitions.
Further, there is a need to create new external definitions when the program changes.
There is also a need to create upgrade mechanisms when the external representation changes.
There is a need to coordinate the release of new application program functions with code that updates the database definitions.
Another disadvantage is that prior approaches do not accommodate Java(copyright) language programs. Thus, there is also a need to provide an object persistence mechanism that is compatible with the Java(copyright) language.
Still another disadvantage of prior approaches is that they store objects themselves in an object-oriented store such as an object-oriented database. Examples for object-oriented databases are Gemstone, Versant, and ObjectStore. Also, current object-relational databases are unfamiliar to many end users and application programmers. Further, many object-oriented stores are not considered stable or reliable. Therefore it is desirable to provide a way to store programmatic objects in a table-oriented relational database.
The foregoing needs, and other needs and objects that will become apparent in the following description, are fulfilled in the present invention, which comprises, in one aspect, a method of persistently storing an information object, having a plurality of data storage fields, from a primary store to a secondary store, the method comprising the steps of associating metadata with the information object, in which the metadata defines attributes of the secondary store specific to a class of the information object; receiving a request to read the information object from the secondary store; when the class of the information object is recognized, retrieving values for the data storage fields from the secondary store and storing the values in a first mapping of the secondary store to the data storage fields.
One feature of the method is that the step of associating metadata with the information object includes the steps of associating with the information object a second mapping of the secondary store to the data storage fields. According to another feature, the step of associating metadata with the information object includes the steps of associating with the information object a stored procedure executable in the secondary store.
Another feature involves the steps of instantiating the information object, in which the information object inherits from a first class and the information object is defined by a second class subclassed from the first class; associating a first table of the secondary store with the first class, and associating a second table of the secondary store with the second class; associating first and second read methods with the first class and the second class, respectively; invoking the second class in response to receiving a request to read the information object from the secondary store; in the second read method, retrieving values for the data storage fields from the second table and storing the values in the information object, recognizing that the values relate only to the second class, and invoking the first read method.
A related feature involves the steps of marking the information object as modified when the information object is modified. Another related feature involves the steps of declaring the information object and a plurality of other information objects as part of a program component; and detecting that the information object is marked as modified, and in response thereto, storing the information object and the plurality of other information objects in the secondary store.
Still another related feature involves the steps of retrieving values for the data storage fields from the second table; storing each of the values in the first mapping; detecting when at least one of the values is a reference to a second information object; and storing, in a second mapping, information that can be used to later resolve the reference to the second information object into second values from the second information object.
According to another feature, the method further has the steps of resolving the reference to the second information object into second values from the second information object. In another feature, the method further has the steps of storing the information object, and a plurality of other information objects that are associated with a functional component of a program, in the secondary store.
In yet another feature, the step of storing further comprises the steps of storing values of data storage fields of the information objects in the first mapping; adding at least one referential constraint, defined in the metadata, to the first mapping; and executing a storage function of the secondary store based on the first mapping. In still another feature, the first mapping comprises a hash mapping of values of the data storage fields and names of columns of a table in the secondary store. In another feature, the first mapping comprises a hash mapping of values of the data storage fields and names of columns of a table in the secondary store.
According to another feature, the step of storing further comprises the steps of receiving a request to write the information object to the secondary store, wherein values of the data storage fields that are to be written to the secondary store are provided in the first mapping; when the class of the information object is recognized, storing the values into the secondary store based on the first mapping.
In another feature, the storing step further comprises the steps of: when the class of the information object is not recognized, passing execution control to a superclass of the information object that can handle the request to write the information object. According to another feature, when the class of the information object is not recognized, passing execution control to a superclass of the information object that can handle the request to read the information object.